#
from typing import Dict
import numpy as np
import torch
import torch.nn as nn
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from apps.fmcw.fmcw_conf import FmcwConf as FC
from apps.fmcw.core.ira_environment import IraEnvironment
from apps.fmcw.core.fmcw_radar import FmcwRadar as FR
from apps.fmcw.core.tsp_agent import TspAgent
from apps.fmcw.core.mpe_dss_agent import MpeDssAgent

class FmcwApp(object):
    def __init__(self):
        self.name = 'apps.fmcw.fmcw_app.FmcwApp'

    @staticmethod
    def startup(params:Dict = {}) -> None:
        print(f'v0.0.1')
        FmcwApp.startup_drl(params=params)

    @staticmethod
    def startup_drl(params:Dict = {}) -> None:
        env = IraEnvironment()
        agents = []
        # agents.append(TspAgent())
        agents.append(MpeDssAgent())
        obs, state = env.setup()
        # FR.draw_antennas() # 绘制天线图
        steps = 0
        while not state.done:
            obs, state = env.step() # obs对Agent可见，state对Agent不可见
            for agent in agents:
                action = agent.notify(obs)
                env.execute(action)
